package com.zyx.thread4;

public class Mother extends Thread{
    private Kitchen kitchen;

    public Mother(Kitchen kitchen) {
        super("妈妈");
        //孩子线程结束 妈妈线程就结束 守护模式
        this.setDaemon(true);
        this.kitchen = kitchen;
    }

    public void cock(){
        try {
            this.kitchen.do_cock();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void run() {
        while (true){
            this.cock();
        }
    }
}
